home *** CD-ROM | disk | FTP | other *** search
- #
- # math.test
- #
- # Tests for the random, min, and commands.
- #---------------------------------------------------------------------------
- # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
- #
- # Permission to use, copy, modify, and distribute this software and its
- # documentation for any purpose and without fee is hereby granted, provided
- # that the above copyright notice appear in all copies. Karl Lehenbauer and
- # Mark Diekhans make no representations about the suitability of this
- # software for any purpose. It is provided "as is" without express or
- # implied warranty.
- #------------------------------------------------------------------------------
- # $Id: math.test,v 2.0 1992/10/16 04:50:02 markd Rel $
- #------------------------------------------------------------------------------
- #
-
- if {[info procs test] != "test"} then {source testlib.tcl}
-
- random seed 100
-
- for {set i 0} {$i < 100} {set i [expr $i+1]} {
- Test math-1.1.$i {random tests} {
- set a [random 10]
- expr "(($a >= 0) || ($a <= 9))"
- } 0 1
- }
-
- Test math-1.2 {random tests} {
- random
- } 1 {wrong # args: random limit | seed [seedval]}
-
- Test math-1.3 {random tests} {
- # Max range varies on some machines, so don't validate that part of
- # the message.
- list [catch {random 0} msg] [lrange $msg 0 6]
- } 0 {1 {range must be > 0 and <=}}
-
- Test math-1.4 {random tests} {
- random seed Foo
- } 1 {expected integer but got "Foo"}
-
- Test math-2.1 {max tests} {
- max 1 2 4 3
- } 0 4
-
- Test math-2.2 {max tests} {
- max -68 65537.4 2 5
- } 0 65537.4
-
- Test math-2.3 {max tests} {
- max -68.7 2100000000 2 5
- } 0 2100000000
-
- Test math-2.4 {max tests} {
- max -68.7 -2
- } 0 -2
-
- Test math-2.5 {max tests} {
- max
- } 1 {wrong # args: max num1 num2 [..numN]}
-
- Test math-2.6 {max tests} {
- max 1 2 3 foo
- } 1 {expected floating-point number but got "foo"}
-
- Test math-3.1 {min tests} {
- min 1 2 4 3
- } 0 1
-
- Test math-3.2 {min tests} {
- min -68.8 64000 2 5
- } 0 -68.8
-
- Test math-3.3 {min tests} {
- min -2000000000 2000000000 2 5
- } 0 -2000000000
-
- Test math-3.4 {min tests} {
- min
- } 1 {wrong # args: min num1 num2 [..numN]}
-
- Test math-3.5 {min tests} {
- min 1 2 3 foo
- } 1 {expected floating-point number but got "foo"}
-
-
-
-